#!/bin/bash


# docker源
#wget -O /etc/yum.repos.d/docker-ce.repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

#cat <<EOF > /etc/yum.repos.d/docker-ce.repo
#[docker-ce-stable]
#name=Docker CE Stable
#baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/8/x86_64/stable
#enabled=1
#gpgcheck=1
#gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
#EOF


#https://cloud.tencent.com/document/product/213/8623
#腾讯云-公网访问地址：http://mirrors.tencent.com
#腾讯云-内网访问地址：http://mirrors.tencentyun.com/

# k8s镜像 - 腾讯云
cat <<EOF > /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=http://mirrors.tencent.com/kubernetes/yum/repos/kubernetes-el7-x86_64/
enabled=1
gpgcheck=0
repo_gpgcheck=0
EOF


cat <<EOF > /etc/sysctl.d/k8s.conf
net.ipv4.ip_forward                 = 1
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOF

#https://cloud.tencent.com/document/product/213/46400
#wget -O /etc/sysctl.d/mysysctl.conf https://gitee.com/bjdgyc/centosinit/raw/master/kube/mysysctl.conf

#sysctl -p /etc/sysctl.d/k8s.conf
sysctl --system


yum install -y htop telnet glances

yum install -y wget socat conntrack ebtables ethtool ipset ipvsadm nftables iproute-tc

yum remove -y kubelet-* kubeadm-* kubectl-*
yum install -y kubelet-1.24.13 kubeadm-1.24.13 kubectl-1.24.13 containerd.io-1.6.21


wget -O /etc/crictl.yaml https://gitee.com/bjdgyc/centosinit/raw/master/kube/crictl.yaml

wget -O /etc/containerd/config.toml https://gitee.com/bjdgyc/centosinit/raw/master/kube/config.toml



systemctl enable kubelet.service
systemctl enable containerd.service
systemctl restart kubelet.service
systemctl restart containerd.service


